namespace PHMEE.PHM.Algorithms.Diagnosis;

/// <summary>
/// 空气压缩机故障诊断算法
/// </summary>
public class AirCompressorAlg
{
    private readonly AirCompressorService.AirCompressorServiceClient _client;

    public AirCompressorAlg(AirCompressorService.AirCompressorServiceClient client)
    {
        _client = client;
    }
    
    /// <summary>
    /// 空气压缩机故障诊断算法
    /// </summary>
    /// <param name="pointPosition"></param>
    /// <param name="data"></param>
    /// <param name="sampleRate"></param>
    /// <param name="equipmentParameters"></param>
    /// <param name="thresholds"></param>
    /// <returns></returns>
    public async Task<AirCompressorResponse> AirCompressorAsync(PointPosition pointPosition, float[] data, float sampleRate,
        AirCompressorEquipmentParameters equipmentParameters, AirCompressorThresholds thresholds)
    {
        var request = new AirCompressorRequest
        {
            Position = pointPosition,
            Data = { data },
            SampleRate = sampleRate,
            EquipmentParameters = equipmentParameters,
            Thresholds = thresholds
        };

        var response = await _client.AirCompressorAlgAsync(request);

        return response;
    }
}